#coding:utf-8

import sys
import wx
import ico

class ServerForm(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent)
        
        
class ServerTray(wx.TaskBarIcon):
    def __init__(self):
        wx.TaskBarIcon.__init__(self)
        
        _icon = ico.getIcon("vhserver")
        self.SetIcon(_icon, u"vhserver")
        self.mnu = wx.Menu()
        self._createMenu(u"Exit", self.OnExit)
        
        self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, lambda evt:self.PopupMenu(self.mnu))
    
    def _createMenu(self, subname, event):
        _id = wx.NewId()
        self.mnu.Append(_id, subname)
        self.Bind(wx.EVT_MENU, event, id = _id)

    def OnExit(self, evt):
        self.RemoveIcon()
        sys.exit()
        